import request from '@/utils/request'


export default{
    // 管理员看到的商品列表
    goodsList(page, size, searchMap) {
        return request({
            url: `manage/goods/goods_main/index?page=${page}&size=${size}`,
            method: 'post',
            data:searchMap
        })
    },
    goodsCategory() {
        return request({
            url: `manage/goods/goods_main/category`,
            method: 'post'
        })
    },
    goodsShop() {
        return request({
            url: `manage/goods/goods_main/shopList`,
            method: 'post'
        })
    },
    goodsVendor() {
        return request({
            url: `manage/goods/goods_main/vendorList`,
            method: 'post'
        })
    },
    // 新增商品
    saveGoods(data) {
        return request({
            url: `manage/goods/goodsMain/add`,
            method: 'post',
            data:data
        })
    },
    // 编辑商品
    editGoods(data) {
        return request({
            url: `manage/goods/goodsMain/edit`,
            method: 'post',
            data:data
        })
    },
    // 上下架删除
    removeGoods(data) {
        return request({
            url: `manage/goods/goods_main/changeStatus`,
            method: 'post',
            data:data
        })
    },
    // 详情
    goodsDetail(id) {
        return request({
            url: `manage/goods/goodsMain/detail?id=${id}`,
            method: 'get',
        })
    },
    // 商品分类
    goodsKind() {
        return request({
            url: `manage/goods/category/index`,
            method: 'get',
        })
    },
    // 保存分类
    saveKind(data) {
        return request({
            url: `manage/goods/category/save`,
            method: 'post',
            data:data
        })
    },
    // 删除分类
    removeKind(id) {
        return request({
            url: `manage/goods/category/delete`,
            method: 'delete',
            data:id
        })
    },
    // 标签列表
    labelList(page, size, seaechKeyword) {
        return request({
            url: `manage/goods/tag/index?page=${page}&size=${size}&tag=${seaechKeyword}`,
            method: 'post',
        })
    },
    // 新增标签
    savelabel(data) {
        return request({
            url: `manage/goods/tag/save`,
            method: 'post',
            data:data
        })
    },
    // 新增规格
    saveItem(data) {
        return request({
            url: `manage/goods/spec/saveItem`,
            method: 'post',
            data:data
        })
    },
    // 导入核销码
    importCode(data) {
        return request({
            url: `manage/ticket/ticket/importTicket`,
            method: 'post',
            data:data,
            headers:{
                "Content-Type": "multipart/form-data",
            }
        })
    },
    // 导出核销码
    exportCode(data, responseType) {
        return request({
            url: `manage/ticket/ticket/exportTicket`,
            method: 'post',
            data:data,
            responseType:responseType
        })
    },
    
    // 商家端看到的商品列表
    shopGoodsList(page, size,searchData) {
        return request({
            url: `manage/shopClient/index/goods?page=${page}&size=${size}`,
            method: 'post',
            data: searchData
        })
    },

    //运费模板
    shippingTemplate(){
        return request({
            url: `manage/goods/shipping/index?page=1&size=999`,
            method: 'get',
        })
    },
    //获取运费模板
    getTemplateById(id){
        return request({
            url: `manage/goods/shipping/getTemplate?id=${id}`,
            method: 'get',
        })
    },
    //留言模板
    messageTemplate() {
        return request({
            url: `manage/goods/goodsMain/messageTemplateList`,
            method: 'get',
        })
    },
    //新增保存运费模板
    saveTemplate(data){
        return request({
            url: `manage/goods/shipping/saveTemplate`,
            method: 'post',
            data
        })
    },
    //删除运费模板
    delTemplate(id){
        return request({
            url: `manage/goods/shipping/del?id=${id}`,
            method: 'delete',
        })
    },
    //删除标签名
    deleteatap(data) {
        return request({
            url: `manage/goods/tag/change`,
            method: 'post',
            data:data
        })
    },
    //搜索商品
    searchForProducts(data) {
        return request({
            url: `manage/goods/goods_main/showSearch`,
            method: 'post',
            data:data
        })
    },

    //搜索商家
    searchForShop(data) {
        return request({
            url: `manage/goods/goods_main/shopList`,
            method: 'post',
            data:data
        })
    },
    //票付通商品获取门票
    getPftTicketList(id) {
        return request({
            url: `manage/goods/goodsMain/getPftTicketList?id=${id}`,
            method: 'get'
        })
    },
    //留言模板列表
    messageTemplateIndex(page, size,searchData) {
        return request({
            url: `manage/goods/message_template/index?page=${page}&size=${size}`,
            method: 'post',
            data:searchData
        })
    },
    //新增修改留言模板
    messageTemplateSave(data) {
        return request({
            url:'manage/goods/message_template/save',
            method:'post',
            data:data
        })
    },
    //删除留言模板
    messageTemplateDelete(id) {
        return request({
            url:'manage/goods/message_template/delete?id='+id,
            method:'delete'
        })
    }
}
